﻿using System.Collections.Generic;
using BLL.Interface;
using DAL.Interface;
using DotNetCoreApi.Filter;
using Plugins.Jwt;
using Microsoft.AspNetCore.Mvc;
using Model;
using Model.DTO;
using Util.Expand;
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;

namespace DotNetCoreApi.Controllers
{
    /// <summary>
    /// 默认、测试接口
    /// </summary>
    [Route("api/default/[action]")]
    [ApiController]
    public class DefaultController : BaseController
    {
        public  JwtHelper jwt { get; set; }
        public ILogger<DefaultController> logger { get; set; }
        /// <summary>
        /// 返回成功
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        [ActionName("success")]
        [HttpPost]
        [ProducesResponseType(typeof(ReturnJson), 200)]
        public void Success(Account account)
        {
            logger.LogInformation("xxx");
        }
        /// <summary>
        /// 返回失败
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [ActionName("fail")]
        [HttpPost]
        [ProducesResponseType(typeof(bool),200)]
        public bool Fail(string id)
        {
            return false;
        }
        /// <summary>
        /// 返回异常
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [ActionName("error")]
        [HttpPost]
        [ProducesResponseType(typeof(ReturnJson), 200)]
        public void Error(string id)
        {
            throw new Exception("自定义异常");
        }


    }
}
